import React from 'react';
import { connect } from 'dva';
import router from 'umi/router';

import { Table } from 'antd';

const formPath = '/Account/AccountSubAccountForm';


@connect(({ accountSubAccount }) => ({ accountSubAccount }))
class List extends React.Component {
  state = {
  }

  treeview = [
      { title: '科目代码', dataIndex: 'account_id.code', },
      { title: '科目名称', dataIndex: 'account_id.name', },
      { title: '代码', dataIndex: 'code', },
      { title: '名称', dataIndex: 'name', },
      { title: '类型', dataIndex: 'sub_type', },
      { title: '业务伙伴', dataIndex: 'partner_id.name', },
      { title: '产品', dataIndex: 'product_id.name', },
      { title: '账簿', dataIndex: 'journal_id.name', },
      { title: '分析科目', dataIndex: 'analytic_account_id.name', },
  ]

  async componentDidMount() {
    const { dispatch } = this.props;
    await dispatch({
      type: 'accountSubAccount/search',
      payload: {domain:[], },

    });

  }

  gotoForm() {
      router.push(formPath);
  }

  render() {
    const { accountSubAccount: { recordsList } } = this.props;

    return (
      <div>
        <div>
          这里是所有的明细科目。只读。服务于报表查询
        </div>
        <div>
          明细科目 = 总账科目 + 业务伙伴/产品
        </div>
        <div>
          在录入凭证时，需要填入 总账科目 + 业务伙伴/产品
        </div>
        <div>
          然后 程序自动生成 明细科目，以方便 报表时查询
        </div>

        <Table columns={this.treeview} dataSource={recordsList} rowKey="id" />

      </div>
    );
  }
}

export default List;





